package src;

/**
 * Created by zy on 2016/2/28.
 */
public class FeatureData implements Data {
    private RealData realData;
    private boolean ready = false;

    public synchronized void setRealData(RealData realData) {
        if (ready) {
            return;
        }
        this.realData = realData;
        this.ready = true;
        notifyAll();
    }

    public synchronized String getContent(){
        while (!ready){
            try {
                wait();
            } catch (InterruptedException e) {
            }
        }
        return realData.getContent();
    }

}
